package com.senlingspace.system.domain.dto;

import com.senlingspace.common.utils.MoneyUtils;
import lombok.Data;

import java.time.LocalDate;
import java.util.Date;

/*微信小程序中商品详情数据*/
@Data
public class ShopProjectDTO {
    /*省*/
    private String provinceName;
    /*市*/
    private String cityName;
    /*区*/
    private String countyName;
    /*详细地址*/
    private String address;
    /*项目周期开始*/
    private LocalDate startDate;
    /*项目周期截止*/
    private LocalDate  endDate;
    /*项目主键*/
    private Long projectId;
    /*项目名称*/
    private String projectName;
    /*项目封面url*/
    private String cover;
    /*背景图*/
    private String backgroundUrl;
    /*项目简介*/
    private String synopsis;
    /*项目须知*/
    private String instructions;
    /*最大价格 单位元*/
    private String maxPrice;
    /*最低价格 单位元*/
    private String minPrice;

    public void setMaxPrice(String maxPrice) {
        if (maxPrice != null) {
            maxPrice = MoneyUtils.fen2Yuan(Long.parseLong(maxPrice));
        }
        this.maxPrice = maxPrice;
    }

    public void setMinPrice(String minPrice) {
        if (minPrice != null) {
            minPrice = MoneyUtils.fen2Yuan(Long.parseLong(minPrice));
        }
        this.minPrice = minPrice;
    }

    public void setCountyName(String countyName) {
        countyName = countyName.replaceAll("/", "");
        this.countyName = countyName;
    }
}
